/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Noto Sans TC", sans-serif;
}

body {
    margin: 0;
    padding: 50px;
    background-color: #F6F6F6;
    min-height: 100vh;
    background: linear-gradient(270deg, rgb(126, 189, 186), rgb(56, 94, 162));
    display: flex;
    justify-content: left;
    align-items: center;
}

/* Header Styles */
.header {
    width: 100vw;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    background: rgba(64, 64, 64, 0.3);
    overflow: hidden;
}

.header-container {
    height: 90px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 120px;
    border-bottom: 1px solid rgba(64, 64, 64, 1);
    background: rgba(64, 64, 64, 1);
    width: 100vw;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo img {
    height: 45px;
    width: 45px;
}

.company-name {
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
}

.company-name-en {
    font-size: 14px;
    color: #ffffff;
}

nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-links {
    display: flex;
    gap: 32px;
    align-items: center;
    list-style: none;
}

.nav-links a {
    color: #ffffff;
    text-decoration: none;
    font-size: 20px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s ease;
}

.nav-links a i {
    margin-bottom: 4px;
}

.nav-links a span {
    font-size: 12px;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.3s ease;
}

.nav-links a:hover span {
    opacity: 1;
    transform: translateY(0);
}

.nav-links a.active,
.nav-links a:hover {
    color: #ffffff;
}

.nav-icon {
    width: 32px;
    height: 32px;
    margin-top: 12px;
    filter: brightness(0) invert(1);
}

/* Dropdown Menu Styles */
.menu-icon {
    cursor: pointer;
    font-size: 24px;
    color: #ffffff;
    margin-left: 20px;
    transition: transform 0.3s ease;
}

.menu-icon:hover {
    color: #66b3ff;
    transform: scale(1.1);
}

.dropdown-menu {
    position: fixed;
    top: 90px;
    right: 0;
    width: 20vw;
    min-width: 300px;
    max-width: 400px;
    height: calc(100vh - 90px);
    background: rgba(64, 64, 64, 0.8);
    box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(-100%);
    transition: transform 0.3s ease, visibility 0s 0.3s, opacity 0.3s ease;
    z-index: 999;
    padding: 20px;
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
}

.dropdown-menu.active {
    transform: translateY(0);
    visibility: visible;
    opacity: 1;
    transition: transform 0.3s ease, visibility 0s, opacity 0.3s ease;
}

.menu-section {
    margin: 0 0 20px 0;
}

.menu-section h3 {
    color: #ffffff;
    font-size: 18px;
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.menu-section h3:hover {
    background-color: rgba(64, 64, 64, 0.3);
}

.menu-section ul {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: rgba(64, 64, 64, 0.3);
}

.menu-section:hover ul {
    max-height: 300px;
}

.menu-section li {
    margin: 0;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

.menu-section:hover li {
    opacity: 1;
    transform: translateX(0);
}

.menu-section:hover li:nth-child(1) { transition-delay: 0.1s; }
.menu-section:hover li:nth-child(2) { transition-delay: 0.2s; }
.menu-section:hover li:nth-child(3) { transition-delay: 0.3s; }
.menu-section:hover li:nth-child(4) { transition-delay: 0.4s; }
.menu-section:hover li:nth-child(5) { transition-delay: 0.5s; }

.menu-section a {
    color: #cccccc;
    text-decoration: none;
    font-size: 15px;
    display: block;
    padding: 8px 25px;
    transition: all 0.3s ease;
}

.menu-section a:hover {
    color: #ffffff;
    background-color: rgba(64, 64, 64, 0.3);
    padding-left: 30px;
}

/* Product Page Styles */
.product-container {
    margin-top: 90px;
    display:flex; 
    height: auto;
    max-width: 1600px;
    justify-content: space-between;
    align-items: left;
    padding: 30px;
}

.product-info {
    flex: 0 0 80%;
    padding-right: 100px;
    text-align: start;
}

.product-info h1 {
    font-size: 28px;
    color: #ffffff;
    margin-bottom: 20px;
}

.product-info h2 {
    font-size: 24px;
    color: #ffffff;
    margin-bottom: 20px;
}

.product-info p {
    font-size: 16px;
    color: #ffffff;
    line-height: 1.6;
    margin-bottom: 20px;
}

.product-info ul {
    list-style: none;
    padding-left: 0;
}

.product-info ul li {
    font-size: 14px;
    color: #ffffff;
    margin-bottom: 10px;
}

.product-image {
    flex: 0 0 80%;
    display: flex;
    flex-direction: row;
    justify-content: left;
    align-items: flex-start;
    gap: 20px;
    position: relative;
    padding-left: 80px;
}

.model-wrapper {
    position: relative;
    width: 70%;
    min-height: 500px;
}

model-viewer {
    width: 100%;
    min-height: 500px;
    background-color: transparent;
    align-items: center;
}

model-viewer::part(default-progress-bar) {
    display: none;
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
    z-index: 10;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 2D Image Container Styles */
.image-2d-container {
    position: fixed;
    top: 90px;
    right: 0px;
    width: 18%;
    height: 100vh;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: rgba(64, 64, 64, 0.8);
    overflow: visible;
}

.scroll-btn {
    width: 40px;
    height: 25px;
    background-color: rgba(64, 64, 64, 0);
    color: #ffffff;
    border: none;
    cursor: pointer;
    z-index: 11;
    transition: background-color 0.3s ease, opacity 0.3s ease;
    border-radius: 0;
    opacity: 0;
    pointer-events: none;
}

.scroll-btn.enabled {
    opacity: 1;
    pointer-events: auto;
}

.scroll-btn:hover {
    background-color: #66b3ff;
}

.scroll-btn.top {
    order: 1;
}

.scroll-btn.bottom {
    order: 3;
    position: fixed;
    bottom: 0px;
}

.image-2d-wrapper {
    order: 2;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 5px;
    width: 100%;
    height: 80vh;
    padding: 10px;
}

.image-2d-item {
    flex: 0 0 33.33%;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.image-2d-item img {
    width: 85%;
    height: 85%;
    object-fit: contain;
    border-radius: 5px;
}

.image-2d-item:hover {
    transform: scale(1.05);
}

.image-2d-item::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(64, 64, 64, 0.9);
    color: #ffffff;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    z-index: 3000;
    pointer-events: none;
}

.image-2d-item:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Pop-up Box Styles */
.image-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.1);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.popup-content {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    background: #ffffff;
    padding: 20px;
    border-radius: 0px;
}

.popup-content img {
    max-width: 100%;
    max-height: 80vh;
    display: block;
}

.close-popup {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 30px;
    color: #404040;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-popup:hover {
    color: #ff4444;
}

/* Back to Top Button Styles */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: #404040;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1000;
}

.back-to-top:hover {
    background-color: #66b3ff;
    transform: scale(1.1);
}

.back-to-top.active {
    opacity: 1;
    visibility: visible;
}

.back-to-top i {
    font-size: 24px;
}

/* Button Container Styles */
.button-container {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 40px;
    padding-top: 40px;
    margin-bottom: 20px;
    background: transparent;
}

.btn {
    padding: 20px 20px;
    font-size: 12px;
    font-weight: 500;
    color: #ffffff;
    background-color: #404040;
    border: none;
    border-radius: 0px;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: auto;
    position: relative;
    z-index: 10;
    width: 180px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    background-color: #66b3ff;
    transform: scale(1.05);
}

.download-btn,
.calculate-btn {
    background-color: rgb(126, 189, 186);
}

.btn-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

/* Responsive Design - Tablet */
@media (max-width: 1024px) {
    .header-container {
        padding: 0 40px;
    }

    .product-container {
        padding: 20px;
        max-width: 90%;
    }

    .product-info {
        flex: 0 0 50%;
    }

    .product-image {
        flex: 0 0 50%;
    }

    .model-wrapper {
        width: 80%;
        min-height: 400px;
    }

    model-viewer {
        min-height: 400px;
    }

    .image-2d-container {
        width: 25%;
    }
}

/* Responsive Design - Mobile */
@media (max-width: 768px) {
    .header-container {
        padding: 0 20px;
    }

    .dropdown-menu {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .product-container {
        padding: 20px;
        flex-direction: column;
        width: 100%;
        height: auto;
        margin-top: 90px;
        align-items: center;
        text-align: center;
    }

    .product-info {
        flex: 0 0 100%;
        padding: 0 20px;
        margin-bottom: 20px;
        order: 2; /* 文字在下 */
    }

    .product-image {
        flex: 0 0 100%;
        flex-direction: column;
        order: 1; /* 圖片在上 */
        margin-bottom: 20px;
    }

    .model-wrapper {
        width: 100%;
        min-height: 250px;
    }

    model-viewer {
        width: 100%;
        height: 250px;
    }

    .product-info h1 {
        font-size: 24px;
        margin-bottom: 15px;
    }

    .product-info h2 {
        font-size: 20px;
        margin-bottom: 15px;
    }

    .product-info p {
        font-size: 14px;
        line-height: 1.5;
    }

    .product-info ul li {
        font-size: 12px;
    }

    .image-2d-container {
        position: static;
        width: 80%;
        height: 400px;
        margin: 20px auto;
    }

    .image-2d-wrapper {
        height: 360px;
    }

    .image-2d-item {
        max-height: 112px;
    }

    .image-2d-item img {
        height: 88px;
    }

    .scroll-btn {
        margin: 5px 0;
    }

    .scroll-btn.bottom {
        position: static;
    }

    .button-container {
        flex-direction: column;
        gap: 15px;
        padding-top: 20px;
    }

    .image-2d-item::after {
        top: -30px;
    }
}